﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;

namespace SeniorDelegate
{
    internal class Program
    {
        public delegate int Calculate(int a,int b);
        //委托
        static void Main(string[] args)
        {
            Calculate cal0 = new Calculate(Multiply);
            Calculate cal1 = new Calculate(Add);
            Console.WriteLine(cal0(4, 5));
            Console.WriteLine(cal1.Invoke(4, 5));
            Console.Read();
        }

        public static int Multiply(int a,int b)
        {
            return a * b;
        }
        public static int Add(int a,int b)
        {
                return (a + b);
        }

    }
}
